package com.jiayang.business.infrareddetailpage;

import com.jiayang.business.infraredpage.domain.dto.PointTemperatureDTO;
import com.jiayang.common.domain.ResponseDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @ Author     ：OuyangChenglong
 * @ Date       ：Created in 10:11 2021/9/8
 * @ Description：红外详情
 * @ Modified By：
 * @Version: $
 */
@Service
public class InfraredDetailService {

    @Autowired
    private InfraredDetailDao infraredDetailDao;

    public ResponseDTO initGetPointTemperature(List<PointTemperatureDTO> pointTemperatureDTO) {
        List<PointTemperatureDTO> pointTemperatureDTOS = new ArrayList<>();
        for (int i = 0; i < pointTemperatureDTO.size(); i++) {
            PointTemperatureDTO temperatureDTO = pointTemperatureDTO.get(i);
            String xLocation = temperatureDTO.getXLocation();
            String yLocation = temperatureDTO.getYLocation();
            Date recordTime = temperatureDTO.getRecordTime();
            String begin = temperatureDTO.getBegin();
            String end = temperatureDTO.getEnd();
            // 根据坐标点位获取温度变化 时间范围和传递形式
            PointTemperatureDTO target = infraredDetailDao.patchGetPointTemperature(xLocation,yLocation,recordTime,begin,end);
            pointTemperatureDTOS.add(target);
        }
        return ResponseDTO.succData(pointTemperatureDTOS);
    }

}
